<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<% String contextPath = request.getContextPath(); 
    request.setAttribute("contextPath", contextPath);%>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>用户推荐分成比例设置</title>

    <!-- Bootstrap Core CSS -->
    <link href="${contextPath}/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="${contextPath}/css/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="${contextPath}/css/sb-admin-2.min.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="${contextPath}/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!--common Css-->
    <link href="${contextPath}/css/common.css" rel="stylesheet">

    <!--information Css-->
    <link href="${contextPath}/css/information.css" rel="stylesheet">
    <link href="${contextPath}/iconfont/iconfont.css" rel="stylesheet">
</head>

<body>


    <div id="wrapper">

        <!-- Navigation -->
         <%@include file="nav.jsp"%>

        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h3 class="page-header">用户推荐分成比例设置</h3>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-6">
                   		<form action="">
                        <div class="form-group">
                            <label for="less" class="col-sm-2 control-label">用户分成比例:</label>
                            <div class="col-xs-2">
                                <input type="text" class="form-control" id="ratio" name="less" value="${resultDto.data}" style="width: 85px; ">
                            </div>
                            <p class="form-control-static">用户在邀请其他用户后获取分成的比例</p>
                        </div>
                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-3">
                                <button type="button" id="save">保存</button>
                                <button type="button" id="reset">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="${contextPath}/js/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="${contextPath}/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="${contextPath}/js/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="${contextPath}/js/sb-admin-2.min.js"></script>

    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
         //点击保存
         $("#save").click(function(){
            var ratio = $("#ratio").val();
            console.log(ratio)
            $.ajax({
            	url:'${contextPath }/WebManager/odds/updateOddsRatioCenter',
          		type:'POST',
          		data:{ratio:ratio},
          		dataType:'json',
          		success:function(data){
	          		if(data.message==='修改成功'){
	          			notice("修改成功");
	          			dispear();
	          		}else if(data.message==='修改失败'){
	          			notice("修改失败");
	          			dispear();
	          		}else if(data.message==='请输入0~1之间的参数'){
	          			notice("请输入0~1之间的参数");
	          			dispear();
	          		}
          		}
             
             })
         });
         //提示信息封装函数
         function notice(notice) {
             var str = '';
             str += '<div class="popupTip">';
             str += notice;
             str += '<span class="glyphicon glyphicon-remove"></span>';
             str += '</div>';
             str += '</strong></div>';
             //wrapper插入str
             $("#wrapper").append(str);
         }

         //取消提示框
         $("#wrapper").on('click', '.glyphicon-remove', function() {
             $(".popupTip").hide();
         });

         function dispear(){
             setTimeout(function(){
                 $(".popupTip").hide();
             }, 3000);
         }
    </script>

</body>

</html>